<template>
<div>
        <div class="apply_title"><i></i>申请人信息</div>
 
<mt-field label="申请人姓名" placeholder="请输入姓名" class="text-right"  v-model="userInfo.name"></mt-field>
<mt-field label="手机号码" placeholder="请输入手机号码" class="text-right"  v-model="userInfo.phone"></mt-field>
<mt-field label="电话" placeholder="请输入电话" class="text-right"  v-model="userInfo.tel"></mt-field>
<mt-field label="邮箱" placeholder="请输入邮箱" class="text-right"  v-model="userInfo.email"></mt-field>

<div class="am-whitespace ws15px"></div>

<mt-field label="纳税人识别号" placeholder="请输入纳税人识别号" class="text-right" :class="tdata.nsrnum.error?'errorcolor':''"  v-model="tdata.nsrnum.vale"></mt-field>
<mt-field label="上年度在宁波市应缴纳的个人所得税（元）" placeholder="请输入" class="text-right titlelong" :class="tdata.nsrnum2.error?'errorcolor':''"  v-model="tdata.nsrnum2.vale"></mt-field>
<mt-field label="上年度在宁波市已缴纳的个人所得税（元）" placeholder="请输入" class="text-right titlelong"  :class="tdata.nsrnum3.error?'errorcolor':''" v-model="tdata.nsrnum3.vale"></mt-field>

<mt-cell title="纳税所在地" is-link  @click.native="show_addPaly" :class="tdata.addPaly.error?'errorcolor':''"  :value="tdata.addPaly.vale" ></mt-cell>
<mt-cell title="工作性质" is-link  @click.native="show_Nature" :class="tdata.Nature.error?'errorcolor':''" :value="tdata.Nature.vale" ></mt-cell>
<div class="am-whitespace ws15px"></div>
<div>
    <div class="mint-radiolist-title country-title">上传材料 <p class="tip">{{tiptext}}</p></div>
    <div class="country-content">
        <Upload limit="3" :imgList="imgList" ></Upload>
    </div>
</div>
<div class="am-whitespace ws15px"></div>
<div>
    <div class="mint-radiolist-title country-title">上传个人2寸照片</div>
    <div class="country-content">
        <Upload limit="1" :imgList="imgList1" ></Upload>
    </div>
</div>

<div class="am-whitespace ws15px"></div>
<div class="inputbtn"><mt-button type="primary" @click="gopage" style="width:100%;">下一步</mt-button></div>

<mt-actionsheet  :actions="tdata.Nature.select"  v-model="tdata.Nature.actionsheet"></mt-actionsheet>
<mt-actionsheet  :actions="tdata.addPaly.select" class="apply_select"  v-model="tdata.addPaly.actionsheet"></mt-actionsheet>
</div>
</template>
<script>
import Upload from '@/components/Upload'
export default {
    data(){
        return{
            userInfo:this.utils.getInfo(),
            tiptext:"独立个人劳务者需出具与在宁波设立的企业、机构所签订的劳务合同",
            error:false,
            imgList:[],
            imgList1:[],
            tdata:{
                nsrnum:{
                    vale:"",
                    error:false
                },
                nsrnum2:{
                    vale:"",
                    error:false
                },
                nsrnum3:{
                    vale:"",
                    error:false
                },Nature:{
                error:false,
                actionsheet:false,
                vale:"选择工作性质",
                select:[{
                    "name":"独立个人劳务",
                    "method":()=>{
                        this.tdata.Nature.vale="独立个人劳务";
                        this.tiptext="独立个人劳务者需出具与在宁波设立的企业、机构所签订的劳务合同";
                    }
                },{
                    "name":"法人代表",
                    "method":()=>{this.tdata.Nature.vale="法人代表";
                    this.tiptext="法人代表出具营业执照";
                    }
                },{
                    "name":"签订劳动合",
                    "method":()=>{
                        this.tdata.Nature.vale="签订劳动合";
                        this.tiptext="受雇人员出具劳动合同或事业单位聘用合同";
                    }
                },{
                    "name":"机关人员",
                    "method":()=>{
                        this.tdata.Nature.vale="机关人员";
                        this.tiptext="提供单位组织部门出具的工作证明";
                        }
                }]
            },addPaly:{
                 error:false,
                actionsheet:false,
                vale:"选择所在地",
                select:[{
                    "name":"市本级",
                    "method":()=>{this.tdata.addPaly.vale="市本级"}
                },{
                    "name":"海曙区",
                    "method":()=>{this.tdata.addPaly.vale="海曙区"}
                },{
                    "name":"江北区",
                    "method":()=>{this.tdata.addPaly.vale="江北区"}
                },{
                    "name":"镇海区",
                    "method":()=>{this.tdata.addPaly.vale="镇海区"}
                },{
                    "name":"北仑区",
                    "method":()=>{this.tdata.addPaly.vale="北仑区"}
                },{
                    "name":"鄞州区",
                    "method":()=>{this.tdata.addPaly.vale="鄞州区"}
                },{
                    "name":"奉化区",
                    "method":()=>{this.tdata.addPaly.vale="奉化区"}
                },{
                    "name":"余姚市",
                    "method":()=>{this.tdata.addPaly.vale="余姚市"}
                },{
                    "name":"慈溪市",
                    "method":()=>{this.tdata.addPaly.vale="慈溪市"}
                },{
                    "name":"宁海县",
                    "method":()=>{this.tdata.addPaly.vale="宁海县"}
                },{
                    "name":"象山县",
                    "method":()=>{this.tdata.addPaly.vale="象山县"}
                },{
                    "name":"保税区",
                    "method":()=>{this.tdata.addPaly.vale="保税区"}
                },{
                    "name":"杭州湾新区",
                    "method":()=>{this.tdata.addPaly.vale="杭州湾新区"}
                },{
                    "name":"大榭开发区",
                    "method":()=>{this.tdata.addPaly.vale="大榭开发区"}
                },{
                    "name":"东钱湖度假区",
                    "method":()=>{this.tdata.addPaly.vale="东钱湖度假区"}
                },{
                    "name":"高新区",
                    "method":()=>{this.tdata.addPaly.vale="高新区"}
                }]
            }
            }
        }
    },
    methods:{
      show_Nature(){
          this.tdata.Nature.actionsheet=true;
      },
      show_addPaly(){
          this.tdata.addPaly.actionsheet=true;
      },      
        gopage(){
                let that=this;
               
                const form = JSON.parse(JSON.stringify(that.tdata));
                that.error = false;
                debugger
                Object.keys(form).map(item=>{
                    if(!form[item].vale||form[item].vale=="选择所在地"||form[item].vale=="选择工作性质"){
                         
                                if(!that.error){
                                    that.toast({
                                        message:'信息未填写完整！',
                                        duration: 3000
                                    });
                                }
                                that.tdata[item].error = true;
                                that.error = true;
                            }else{
                                that.tdata[item].error = false;
                            }
                    });
             if(!that.error){
                   let params ={
                        head:{mscode: "RC007"},
                        content:{
                            a0100:that.utils.getInfo().name
                        }
                    }
                    params.head = JSON.stringify(params.head );
                    params.content = JSON.stringify(params.content );
                    params = that.qs.stringify(params);

                    if(that.tdata.Nature.vale==="独立个人劳务"){
                        that.$router.push({path:"/applycondition"})
                    }else{
                        that.$router.push({path:"/applycompony"})
                    }

             }

            
        }
    },
    components:{
        Upload
    },
    mounted(){
        
       console.log(this.utils.getInfo())
    }
}
</script>
<style lang="less">
.errorcolor .mint-cell-text{ color:#ff0000;}
.text-right .mint-cell-wrapper .mint-cell-value .mint-field-core{
         text-align: right;
}
.apply_title{height: .4rem;line-height: .4rem; background-color: #ffffff;
i{width: 0;height: 0;border-style: solid;border-width: .1rem 0 .08rem .08rem;border-color: transparent transparent transparent #007bff; float: left; margin: .1rem .1rem 0 .2rem } 
}
.country-title{ margin:-.05rem .08rem .08rem;
.tip{ font-weight: bold; color:#26a2ff;}
}
.country-content{ background-color: #ffffff; padding: .1rem 0 .05rem .1rem;}
.inputbtn{ padding:.2rem .1rem .1rem}
.titlelong .mint-cell-wrapper .mint-cell-title{width: 2rem}
.apply_select .mint-actionsheet-list{ overflow-y: auto; height: 3rem;}
</style>